/*
 * This file is part of the Sx Framework Library.
 * 
 * Copyright (C) 2013 University of Colorado Denver
 * <min.choi@ucdenver.edu> <shane.transue@ucdenver.edu>
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy 
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
 * copies of the Software, and to permit persons to whom the Software is 
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in 
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 * DEALINGS IN THE SOFTWARE.
 */
#ifndef SX_PROGRESSABLE_H
#define SX_PROGRESSABLE_H

#include <sxString.h>

namespace Sx {
namespace Task {

/*
 * This interface defines the operations that are available for long running
 * tasks that should show the current progress to the user through some
 * interface implementation (Text, system state, ProgressBars, etc.)
 */
class Progressable {
public:
	virtual void setTitle(const String& title) = 0;

	/*
	 * Progressable displays should show a brief message about what operation
	 * is currently being performed.
	 */
	virtual void setDescription(const String& text) = 0;

	/*
	 * Sets the range of the task. This is a simplification of the total number
	 * of individual tasks to be performed.
	 */
	virtual void setRange(unsigned int min, unsigned int max) = 0;

	/*
	 * Sets the value of the progess element. This should be between the values
	 * provided for the range of the task. The implementation of this function
	 * should ensure that the value is in the defined range (see setRange(..))
	 */
	virtual void setValue(unsigned int value) = 0;

	/*
	 * This implemented function should be called when the progressable task
	 * has been completed. (Generally this can be used for closing dialogs or
	 * printing messages about how the task was completed).
	 */
	virtual void complete() = 0;

	/*
	 * Defines whether or not the operation has been canceled by the user. Long
	 * running tasks are commonly incorrectly initialized or simply not 
	 * required; the user should be able to cancel the operation based on their 
	 * discretion.
	 */
	virtual bool canceled() = 0;
};

}

}

#endif
